<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jquery.min.js"></script>
</head>
<body>
    <input type="text" id="message">
    <button id="submit">Submit</button>
    <script>
        let webscoket = new WebSocket('ws://127.0.0.1:8080/test');
        webscoket.onopen=function(){
            console.log('jli');
        }
        webscoket.onmessage=function(e){
            console.log(e.data);
        }
        webscoket.onclose=function(){
            console.log('close');
        }
        let input = document.querySelector('#message');
        let button = document.querySelector('#submit');
        button.onclick=function(){
            webscoket.send(input.value);
        }
    </script>

</body>
</html>